package com.huang.memory;

/**
 * 目标:
 * 知道多个数组变量指向同一个数组对象的原因
 */
public class Demo2_Array {
    public static void main(String[] args) {
        int[] arr = {20, 10, 30, 40};
        int[] arr2 = arr;
        for (int i = 0; i < arr.length; i++) {
            System.out.println(arr[i]);
        }
        System.out.println("------------------");
        for (int i = 0; i < arr2.length; i++) {
            System.out.println(arr2[i]);
        }

        arr2[1] = 1;
        System.out.println(arr[1]);
    }
}